package gov.kqqzyyy.monkey.clinicscreen.mytools;

/**
 * Created by Monkey on 2017/10/26.
 */

public class MyStringUtil {

    public static String doHideName(String orName) {
        if (orName.equals("")) {
            return "";
        } else if (orName.length() == 2) {
            return orName.charAt(0) + "*";
        } else {
            StringBuilder temp = new StringBuilder(orName.substring(0, 1));
            for (int i = 0; i < orName.length() - 2; i++) {
                temp.append("*");
            }
            temp.append(orName.substring(orName.length() - 1));
            return String.valueOf(temp);
        }
    }

    public static String doFormatXH(String pdxh) {
        switch (pdxh.length()) {
            case 1:
                return "000" + pdxh;
            case 2:
                return "00" + pdxh;
            case 3:
                return "0" + pdxh;
        }
        return pdxh;
    }
}
